﻿@{
    WikiDocumentDetailModel doc = this.ViewBag.Document;
    ViewBag.Title = doc.Title;
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
@using Ace.Application.Wiki;
@using Chloe.Home.Models;
@section ScriptAndStyle{
    @this.RefStyle("~/Content/editormd/css/editormd.min.css")
    @this.RefStyle("~/Content/css/wx.css")
    @this.RefScript("~/Content/editormd/lib/prettify.min.js")
}
<script>
    $(function () {
        $(".bodyContent pre").addClass("prettyprint");/* linenums */
        PR.prettyPrint();

        $("#mw-panel").find("h5").click(function () {
            var t = $(this), b = t.next(".body"), p = t.parent();
            if (b.is(":visible")) {
                b.slideUp("fast");
                p.removeClass("active");
            } else {
                b.find("li").find("em").addClass("none");
                b.slideDown("fast", function () {
                    b.find("li").find("em").removeClass("none");
                });
                p.addClass("active");
            }
            $(this).parent().siblings(".portal").removeClass("active").find(".body").slideUp("fast");
        });
    });
</script>
<div style="margin-top:100px;" class="mainwrapper" id="documentation">
    <div class="inner">
        @*@Html.Partial("Menu", new { RootNodes = this.ViewBag.RootNodes, CurrentNodeId = this.ViewBag.CurrentNodeId })*@

        <div id="mw-panel">
            @foreach (WikiMenuTreeNode rootNode in this.ViewBag.RootNodes)
            {
                string currentNodeId = this.ViewBag.CurrentNodeId;
                bool expanded = rootNode.ChildNodes.Any(c => c.Id == currentNodeId);

                string activeClass = expanded ? "portal active" : "portal";
                string display = expanded ? "block" : "none";
                <div class="@activeClass" id='@rootNode.Id'>
                    <h5><span class="portal_arrow"></span>@rootNode.Name</h5>
                    <div class="body" style="display:@display">
                        <ul>
                            @foreach (WikiMenuTreeNode childNode in rootNode.ChildNodes)
                            {
                                if (childNode.Id == currentNodeId)
                                {
                                    <li id="@childNode.Id"><a href="@childNode.Url" style="color:#01AAED;">&nbsp;&nbsp;&nbsp;@childNode.Name</a></li>
                                }
                                else
                                {
                                    <li id="@childNode.Id"><a href="@childNode.Url">&nbsp;&nbsp;&nbsp;@childNode.Name</a></li>
                                }
                            }
                        </ul>
                    </div>
                </div>
            }
        </div>

        <div id="content">
            <div class="content_hd">
                <h2 id="firstHeading" class="firstHeading">@doc.Title</h2>
                <div class="info">
                </div>
            </div>
            <div id="bodyContent" class="bodyContent markdown-body editormd-preview-container">
                @this.Raw(doc.HtmlContent)
            </div>
        </div>
    </div>
</div>
